Emoji chooser: Also check for hex boxes
authorMatthias Clasen <mclasen@redhat.com>
Thu, 19 Jul 2018 21:57:19 +0000 (17:57 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 20 Jul 2018 00:51:22 +0000 (20:51 -0400)
We don't want to see those either.

gtk/gtkemojichooser.c

index 68cabda67e0268cc231a1adf974dd910ea373a1f..ee17ea3cf18f44fe04312c5dab2dfa0cd7179996 100644 (file)
@@ -404,7 +404,8 @@ add_emoji (GtkWidget    *box,
   pango_layout_get_extents (layout, &rect, NULL);
 
   /* Check for fallback rendering that generates too wide items */
-  if (rect.width >= 1.5 * chooser->emoji_max_width)
+  if (pango_layout_get_unknown_glyphs_count (layout) > 0 ||
+      rect.width >= 1.5 * chooser->emoji_max_width)
     {
       gtk_widget_destroy (label);
       return;
@@ -654,7 +655,8 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
   /* Get a reasonable maximum width for an emoji. We do this to
    * skip overly wide fallback rendering for certain emojis the
    * font does not contain and therefore end up being rendered
-   * as multiply glyphs. */
+   * as multiply glyphs.
+   */
   {
     PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (chooser), "🙂");
     PangoAttrList *attrs;